<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>三栏布局</title>
    <style>
        /* 1、浮动+margin */
        .box {
            background-color: #eee;
            /* < !-- 生成BFC，计算高度时考虑浮动的元素 --> */
            overflow: hidden;
            padding: 20px;
            height: 200px;
        }

        .left {
            float: left;
            width: 200px;
            height: 200px;
            background-color: blueviolet;
        }

        .right {
            float: right;
            width: 120px;
            height: 200px;
            background-color: brown;
        }

        .middle {
            margin-left: 220px;
            height: 200px;
            margin-right: 240px;
            background-color: aqua;
        }

        /* 2、两边使用 absolute，中间使用 margin */
        /* .box {
            background-color: #eee;
            position: relative;
        }

        .left,
        .right,
        .middle {
            height: 200px;
            line-height: 200px;
            text-align: center;
        }

        .left {
            position: absolute;
            top: 0px;
            left: 0px;
            width: 100px;
            background-color: blueviolet;
        }

        .right {
            position: absolute;
            top: 0;
            right: 0;
            width: 100px;
            background: green;
        }

        .middle {
            margin: 0 110px;
            background: black;
            color: white;
        } */

        /* table布局 */
        /* .box {
            display: table;
            table-layout: fixed;
        }

        .left,
        .right,
        .middle {
            height: 200px;
            display: table-cell;
            color: red;
        }

        .left,
        .right {
            width: 20px;
            background-color: blueviolet;
        }

        .middle {
            background: black;
            width: 100%;
        } */

        /* flex布局 */
        /* .box {
            display: flex;
            justify-content: space-between;
        }

        .left,
        .right,
        .middle {
            height: 200px;
            color: red;
        }

        .left,
        .right {
            width: 20px;
            background-color: blueviolet;
        }

        .middle {
            background: black;
            width: 100%;
        } */

        /* 网格布局 */
        /* .box {
            background-color: #eee;
            display: grid;
            grid-template-columns: 20px auto 20px;
        }

        .left,
        .right,
        .middle {
            height: 200px;
            color: red;
        }

        .left,.right {
            background-color: blueviolet;
        }
        .middle {
            background: black;
        } */
    </style>
</head>

<body>
    <div class="box">
        <div class="left">
            左侧边栏
        </div>
        <div class="middle">
            内容区
        </div>
        <div class="right">
            右侧边栏
        </div>
    </div>
</body>

</html>